﻿@model JTWEB3.Views.News.IndexModel
@{
    ViewData["Title"] = "新闻详情";
    Layout = "/Views/Shared/_Layout.cshtml";
}

<nav class="breadcrumb">
    <a class="breadcrumb-item" asp-action="Index" asp-controller="Home"><span class="fa fa-home"></span> 网站首页</a>
    <a class="breadcrumb-item" asp-action="Index" asp-controller="@ViewData["controller"]">动态新闻</a>
    <span class="breadcrumb-item active">@ViewData["Title"]</span>
</nav>
<div class="row">
    <div class="col-sm-8">
        <h2> @Model.News.data.Title</h2>
        <div class="news-status">发布时间 @Model.News.data.PublishDate 评论 @Model.News.data.CommentCount </div>
        <div class="news-content">



            @Html.Raw(@Model.News.data.ContentsHtml)


            <!-- 代码 开始 -->
            <div id="appgame-leftside-share">
                <div class="appgame-leftside-share rwt_share" id="rwt_share">
                    <a class="appgame-leftside-weixin" data-cmd="weixin" title="分享到微信">微信</a>
                    <a class="appgame-leftside-qzone" data-cmd="qzone" title="分享到QQ空间">QQ空间</a>
                    <a class="appgame-leftside-sqq" data-cmd="sqq" title="分享到QQ好友">QQ好友</a>
                    <a class="appgame-leftside-tsina" data-cmd="tsina" title="分享到新浪微博">新浪微博</a>
                    <a class="appgame-leftside-fbook" data-cmd="fbook" title="分享到Facebook">Facebook</a>
                    <a class="appgame-leftside-twi" data-cmd="twi" title="分享到Twitter">Twitter</a>
                </div>
                <a class="appgame-leftside-top" onclick="gotoTPoint(&#39; top &#39;, 400;)"></a>
            </div>
            <script type="text/javascript" src="~/js/lrtk.js"></script>
            <script type="text/javascript" src="~/js/share.min.js"></script>
            <!-- 代码 结束 -->
        </div>
        <div class="title" id="comment">
            <h3>评论</h3>
        </div>
        <div id="respond">
            <form id="comment-form" name="comment-form" action="" method="POST">
                <div class="comment">
                    <div class="comment-box">
                        <textarea placeholder="您的评论或留言（必填）" name="comment-textarea" id="comment-textarea" cols="100"
                                  rows="3" tabindex="3"></textarea>
                        <div class="comment-ctrl">
                            <div class="comment-prompt" style="display: none;">
                                <i class="fa fa-spin fa-circle-o-notch"></i> <span class="comment-prompt-text">评论正在提交中...请稍后</span>
                            </div>
                            <div class="comment-success" style="display: none;">
                                <i class="fa fa-check"></i> <span class="comment-prompt-text">评论提交成功...</span>
                            </div>
                            <button type="button" name="comment-submit" id="comment-submit" onclick="addComment()"
                                    tabindex="4">
                                评论
                            </button>
                        </div>
                    </div>
                </div>
            </form>

        </div>
        <div id="postcomments">
            <ol id="comment_list" class="commentlist">
                @foreach (var m in Model.CommentList.data)
                {
                <li class="comment-content">
                    <span class="comment-f">@m.Floor</span>

                    <div class="comment-main">
                        <p>
                            <a class="address" href="#" rel="nofollow" target="_blank">匿名</a><span class="time">@m.AddTime</span><br>@m.Contents
                        </p>
                    </div>
                </li>
                }

            </ol>
        </div>
    </div>
    <div class="col-sm-4">
        <div class="side-bar-card ">
            <div class="card-title">相关推荐</div>
            <div class="card-body">
                <div class="list">
                    @foreach (var m in Model.HotNewsList.data)
                    {
                    <div class="item myrow">
                        <div class="col-sm-5 no-padding-h"><img src="@m.Image" alt="Alternate Text" /></div>
                        <div class="col-sm-7">
                            <div class="title">
                                @m.Title
                            </div>
                            <div class="desc">发布时间 @m.PublishDate 评论 @m.CommentCount</div>

                        </div>
                    </div>
                    }


                </div>
            </div>
        </div>
     
    </div>
</div>
<script>
    function addComment() {
        var content = $("#comment-textarea").val();
        if (content != "" && content != null) {
            $.ajax({
                type: 'post',
                url: '/News/AddComment',
                data: {
                    NewsId: @Model.News.data.Id,
                    Contents: content
                },
                success: function (data) {
                    if (data.code == 200) {
                        $("#comment-textarea").val("");
                        var html = '<li class="comment-content"><span class="comment-f">' + data.data
                            .floor +
                            '</span><div class="comment-main"><p><a class="address" rel="nofollow" target="_blank">匿名</a><span class="time">' +
                            data.data.addTime + '</span ><br>' + data.data.contents + '</p></div></li>';
                        $("#comment_list").prepend(html);
                    } else {
                        alert(data.result);
                    }
                },

            });
        }
    }
</script>
<link href="~/css/share.css" rel="stylesheet" type="text/css" />
<!-- <link rel="stylesheet" type="text/css" href="~/admin/css/style.css"> -->
<script type="text/javascript" src="~/js/jquery.min.js"></script>
